<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="949.46">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco; min-height: 14.0px}
p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco}
p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #006600}
span.s1 {text-decoration: underline}
span.s2 {color: #0021b9}
span.s3 {color: #8c1d1e}
span.Apple-tab-span {white-space:pre}
</style>
</head>
<body>
<p class="p1"><b>PV_SpectralEnahnce<span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>a harmonic enhancer</b></p>
<p class="p2"><br></p>
<p class="p2"><br></p>
<p class="p3"><b>PV_SpectralEnhance(buffer, numPartials, ratio, strength)</b></p>
<p class="p2"><br></p>
<p class="p3"><b><span class="Apple-tab-span">	</span>buffer - the FFT buffer to filter</b></p>
<p class="p3"><b><span class="Apple-tab-span">	</span>numPartials - the number of partials above each bin to add magnitude to</b></p>
<p class="p3"><b><span class="Apple-tab-span">	</span>ratio - the ratio between the original partial and the partials above to add harmonic content to (should</b></p>
<p class="p3"><b><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>be greater the 1... usually 2 or greater).</b></p>
<p class="p3"><b><span class="Apple-tab-span">	</span>strength - a multiplier for each successive partial.<span class="Apple-converted-space"> </span></b></p>
<p class="p2"><b><span class="Apple-tab-span">	</span></b></p>
<p class="p3"><b><span class="s1">How numPartials, ratio and strength are used.</span></b></p>
<p class="p2"><br></p>
<p class="p3"><b>if you have a bin (e.g., bin 10) with magnitude of 1, magnitude will be added to numPartial bins above that bin according to the ratio. If numPartial is 4 and the ratio is 2, magnitude will be added to bins 20, 30, 40 and 50. If strength is 0.1, bin 20 will get an additional 0.1 * the original magnitude (0.1), bin 30 will get (0.1 / 2), bin 40 will get (0.1 / 3) and bin 50 (0.1 / 4). Strength can be any positive number.</b></p>
<p class="p2"><b><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-converted-space"> </span></b></p>
<p class="p3"><b>Examples:</b></p>
<p class="p4"><br></p>
<p class="p4"><br></p>
<p class="p5">s.boot;</p>
<p class="p6"><br></p>
<p class="p7">z = Buffer.read(s, "sounds/a11wlk01.wav")</p>
<p class="p7">(</p>
<p class="p7">x = <span class="s2">SynthDef</span>(<span class="s3">\specEnhance</span>, {arg ratio = 2;</p>
<p class="p7"><span class="Apple-tab-span">	</span><span class="s2">var</span> a, chain, out;</p>
<p class="p7"><span class="Apple-tab-span">	</span>a = <span class="s2">LocalBuf</span>.new(<span class="s2">2048</span>);</p>
<p class="p7"><span class="Apple-tab-span">	</span>// Sin tone</p>
<p class="p8">//<span class="Apple-tab-span">	</span>chain = FFT(a, SinOsc.ar(440), 0.5);</p>
<p class="p7"><span class="Apple-tab-span">	</span>// sf playback</p>
<p class="p8">//<span class="Apple-tab-span">	</span>chain = FFT(a, PlayBuf.ar(1, z, loop: 1));</p>
<p class="p7"><span class="Apple-tab-span">	</span>// something a little more complext</p>
<p class="p7"><span class="Apple-tab-span">	</span>chain = FFT(a, SinOsc.ar(440 + SinOsc.ar(1760, 0.23, 2059), 0, 0.2));</p>
<p class="p7"><span class="Apple-tab-span">	</span>// MouseX controls strength</p>
<p class="p7"><span class="Apple-tab-span">	</span>chain = PV_SpectralEnhance(chain, 8, ratio, MouseX.kr(0, 0.99));</p>
<p class="p7"><span class="Apple-tab-span">	</span>out = <span class="s2">IFFT</span>(chain);</p>
<p class="p7"><span class="Apple-tab-span">	</span><span class="s2">Out</span>.ar(<span class="s2">0</span>, out.dup);</p>
<p class="p7">}).play(s)</p>
<p class="p7">)</p>
<p class="p6"><br></p>
<p class="p7">x.set(\ratio, 2.1)</p>
<p class="p7">x.set(\ratio, 3.1)</p>
<p class="p7">x.set(\ratio, 0.98)</p>
<p class="p6"><br></p>
<p class="p7">x.free;</p>
<p class="p7">z.free;</p>
</body>
</html>
